import request from '@/utils/request.js'

//管理员注册
export const adminRegister = (registerData) => {
  //借助于UrlSearchParams完成传递
  console.log(new URLSearchParams(registerData));
  return request.post('/admin/register',new URLSearchParams(registerData));
}

//管理员登录
export const adminLogin = (loginData) => {
  const params = new URLSearchParams();
  for(let key in loginData){
    params.append(key,loginData[key])
  }
  return request.post('/admin/login',params)
}

//管理员获取个人信息
export const getAdminInfo = () => {
  return request.get('/admin/info')
}

//更新管理员信息
export const updateAdminInfo = (updateData) => {
  return request.post('/admin/update',updateData)
}

//更改密码
export const updatePassword = (passwordData) => {
  return request.patch('/admin/password',passwordData)
}